{%mainunit bitcoin_p2p.pas}

{$IFDEF INTERFACE}
type
  { TTxOut is part of a Tx message. It is not a stand-alone protocol message
    but it has the same Parse and Serialize mechanism as messages }
  TTxOut = class(TMsg)
    Value            : UInt64;        // here are the coins!
    PublicKeyScript  : String;
    procedure ParseAndProcess; override;
    procedure SerializeToStream(AStream: TStringStream);
  end;

{$ENDIF}
{$IFDEF IMPLEMENTATION}

procedure TTxOut.ParseAndProcess;
begin
  Value := ReadQWord;
  PublicKeyScript := ReadVarStr;
end;

procedure TTxOut.SerializeToStream(AStream: TStringStream);
begin
  FSendData := AStream;
  WriteQWord(Value);
  WriteVarStr(PublicKeyScript);
end;

{$ENDIF}
